<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML>
<html>
<head>
    <%@ include file="/admin/header.jsp" %>
    <% request.setAttribute("saveUrl", com.sz.controller.frame.UserController.SAVE_URL);
        request.setAttribute("listUrl", com.sz.controller.frame.UserController.LIST_URL);
    %>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span><a href="${ctx}${listUrl}">用户管理</a>
    <span class="c-gray en">&gt;</span><c:if test="${user == null }">添加用户</c:if><c:if
        test="${user.id != null }">修改用户</c:if>
    <a class="btn btn-success radius r"
       style="line-height: 1.6em; margin-top: 3px"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<div class="page-container">
    <form id="addForm" class="form form-horizontal" action="${ctx}${saveUrl}"
          method="post" enctype="multipart/form-data">
        <input name="id" type="hidden" value="${user.id }">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>用户名：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="username" name="username" class="input-text" value="${user.username }" type="text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>姓名：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="name" name="name" class="input-text" value="${user.name }" type="text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>职位：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="position" name="position" class="input-text" value="${user.position }" type="text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">座机：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="telphone" name="telphone" class="input-text" value="${user.telphone }" type="text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>手机：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="cellphone" name="cellphone" class="input-text" value="${user.cellphone }" type="text">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>密码：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="password" name="password" class="input-text" value="${user.password }" type="password">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>确认密码：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="confirm_password" name="confirm_password" class="input-text" value="${user.password }"
                       type="password">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <button class="btn btn-primary radius" type="submit">
                        <i class="Hui-iconfont">&#xe632;</i> 保存
                    </button>
                <button onClick="setNo();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;
                </button>
            </div>
        </div>
    </form>
</div>
<%@ include file="/admin/footer.jsp" %>
<script type="text/javascript">

    $(document).ready(function () {

        $("#addForm").validate({
            rules: {
                userStatus: {
                    required: true
                },
                username: {
                    required: true,
                    minlength: 3
                },
                name: {
                    required: true,
                    minlength: 2,
                    maxlength: 30
                },
                password: {
                    required: true,
                    minlength: 3
                },
                confirm_password: {
                    required: true,
                    minlength: 3,
                    equalTo: "#password"
                },
                cellphone: {
                    required: true,
                    isMobile: true
                }
            },
            onkeyup: false,
            focusCleanup: true,
            success: "valid",
            submitHandler: function (form) {
                form.submit();
            }
        });
    });
</script>
</body>
</html>